Gem5-gpu Installation Guide:

Introduction

This article gives a step by step guide for the installation of gem5-gpu simulator along with the solution to the errors that maybe encountered during the installation.

NOTE:

  • The gcc and g++ version used during the installation was gcc-5.4 and g++-5.4 .
  • Try to execute all the statements in the same terminal. Changing the terminal may require to execute the export statements again.

I. Gem5

First of all, you need to install the dependencies by typing the commands 1-7 in your terminal

1. sudo apt-get install mercurial
2.sudo apt-get install build-essential
3.sudo apt-get install scons
4.sudo apt-get install python-dev
5.sudo apt-get install swig
6.sudo apt-get install libprotobuf-dev python-protobuf protobuf-compiler libgoogle-perftools-dev
7.sudo apt-get install swig gcc m4 python python-dev libgoogle-perftools-dev mercurial scons g++ build-essential

Now you need to clone the gem5 repository and build it onto your system by following steps 8-12.

8.hg clone http://repo.gem5.org/gem5
9.cd gem5/
10.scons build/ARM/gem5.opt -j2

In case you encounter a protobuf error, try changing your gcc version.

11.build/ARM/gem5.opt configs/example/se.py -c tests/test-progs/hello/bin/arm/linux/hel­lo

Your output should look like this:

12.cd

II. Gem5-gpu

For gem5-gpu, you need to install CUDA Toolkit version 3.2 (newer versions are not yet supported) and set its path. To do so you need to follow the commands 1-6.

1. wget http://developer.download.nvidia.com/compute/cuda/3_2_prod/toolkit/cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
2. chmod +x ./cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
3. sudo ./cudatoolkit_3.2.16_linux_64_ubuntu10.04.run
4. export CUDAHOME="/usr/local/cuda"
5. export PATH=$PATH:"/usr/local/cuda/bin"
6. export LD_LIBRARY_PATH="/usr/local/cuda/lib64"

Now, you need to edit .hgrc file . Open the file using command 7.

7. vim .hgrc

Pressi to enter into the insert mode and paste the command 8 into the file.

8.  [extensions]
    mq=

    [ui]
    username = your_username <email>

Press Esc then:wq! to save the changes in the file and exit.

Next, make a directory of gem5-gpu in your home folder and clone the required patches in this directory by using the commands 9-20.

9. mkdir gem5-gpu
10. cd gem5-gpu
11. hg qclone http://repo.gem5.org/gem5 -p http://gem5-gpu.cs.wisc.edu/repo/gem5-patches
12. cd gem5/
13. hg update -r 11060
14. hg qpush -a
15. cd ..
16. hg qclone http://gem5-gpu.cs.wisc.edu/repo/gpgpu-sim -p http://gem5-gpu.cs.wisc.edu/repo/gpgpu-sim-patches
17. cd gpgpu-sim
18. hg qpush -a
19. cd ..
20. hg clone http://gem5-gpu.cs.wisc.edu/repo/gem5-gpu

Now build gem5-gpu as follows.

21. cd gem5/
22. scons build/X86_VI_hammer_GPU/gem5.opt --default=X86 EXTRAS=../gem5-gpu/src:../gpgpu-sim/ PROTOCOL=VI_hammer GPGPU_SIM=True

If you encounter an error regarding 'CUDAHOME' then it means that you have changed the terminal and you need to specify the path for CUDAHOME again by typing the command 4 mentioned above. In case you encounter a protobuf error, try changing your gcc version and executing the command 22 again. If the error still persists, it means you have done something wrong while following the commands and you need to start the installation process again from the beginning.

Now, the next step is to install CUDA-SDK for version 3.2 and specify the path by following the commands 23-27.

23. cd
24. wget http://developer.download.nvidia.com/compute/cuda/3_2_prod/sdk/gpucomputingsdk_3.2.16_linux.run
25. chmod +x ./gpucomputingsdk_3.2.16_linux.run
26. sudo ./gpucomputingsdk_3.2.16_linux.run
27. export NVIDIA_CUDA_SDK_LOCATION=/home/<username>/NVIDIA_GPU_Computing_SDK/C

Now you need to compile CUDA SDK by the following commands

28. cd /home/<username>/NVIDIA_GPU_Computing_SDK/C/common
29. make
30. cd

The installation of gem5-gpu is now complete and now you need to run the benchmark test to see if your gem5-gpu is working fine.

To do so, follow the steps 31-46.

31. cd gem5-gpu
32. hg clone https://gem5-gpu.cs.wisc.edu/repo/benchmarks/
33. cd benchmarks/libcuda
34. make

In case you encounter an error related to nvcc, add /usr/local/cuda and /usr/local/cuda/bin in the environment path file as follows:

Open file by the command:

gksudo gedit /etc/environment

append:

:usr/local/cuda:usr/local/cuda/bin

to the file and save it.

Change your gcc version to 4.4 by following the steps 35-40.

In case you encounter the error regarding no installation candidate, perform the following steps:

gedit /etc/apt/sources.list

copy the following command in the file -

deb http://dk.archive.ubuntu.com/ubuntu/ trusty main universe

deb http://dk.archive.ubuntu.com/ubuntu/ trusty-updates main universe

now close the file and execute

sudo apt-get update

35. sudo apt-get install gcc-4.4
36. sudo apt-get install g++-4.4
37. sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
38. sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 40
39. sudo update-alternatives --config gcc
40. sudo update-alternatives --config g++
41. cd
42. cd gem5-gpu/benchmarks/rodinia/backprop
43. make gem5-fusion

In case you encounter an error related to libcutil_x86_64.a, open file benchmarks/rodinia/common/common.mk and change the value of variable LIB from -L/usr/lib64 to -L/home/<username>/NVIDIA_GPU_Computing_SDK/C/lib and save the file.

44. cd
45. cd gem5-gpu/gem5/
46. build/X86_VI_hammer_GPU/gem5.opt /home/<username>/gem5-gpu/gem5-gpu/configs/se_fusion.py -c /home/<username>/gem5-gpu/benchmarks/rodinia/backprop/gem5_fusion_backprop -o "16"

Your output should look like:

Congratulations!! Your installation is now complete.

References:

results matching ""

    No results matching ""